package com.goverse.mancraft.man.action;

import com.goverse.mancraft.CommonParams;

/**
 * Created by gaoyu on 2017/4/15.
 */

public class SleepAction extends AbstractAction{

    private Runnable mSleepThread = new Runnable() {
        @Override
        public void run() {
            mMan.setIsSleep(false);
            wakeUp();
        }
    };

    @Override
    public int getLoseHp() {
        return 1;
    }

    @Override
    public void onStop() {

        mHandler.removeCallbacks(mSleepThread);
    }

    @Override
    public void onStart() {

        mMan.setIsSleep(true);
        mHandler.postDelayed(mSleepThread, CommonParams.SLEEP_TIME * 1000);
    }
}
